<template>
  <div>
    <el-card shadow="never">
      <div slot="header">
        <el-button @click="$router.go(-1)">返回</el-button>
      </div>
      <el-tabs class="classify-tabs" :tab-position="tabPosition">
        <el-tab-pane
          v-for="(item,index) in listData"
          :key="index"
          :label="item.name + '(' + item.evalDetailedList.length + '次)'"
        >
          <eval-table :list="item" ref="evalTable" />
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script>
import EvalTable from './Table'
import { planVerifyTable } from '@/api/eval'

export default {
  components: {
    EvalTable
  },
  data() {
    return {
      tabPosition: 'left',
      row: JSON.parse(this.$route.params.row),
      listData: [],
      tableArr: []
    }
  },
  async created() {
    console.log('row', this.row)

    if (this.row) {
      const res = await planVerifyTable(this.row.evalPlanId)
      console.log('planVerifyTable list', res.data)

      if (res.state === '000000' && res.data.length > 0) {
        this.listData = res.data
      }
    } else {
      this.$message.error('页面发生错误，即将跳转回列表页')
      setTimeout(() => {
        this.$router.push({
          name: 'evaluatePlanVerify'
        })
      }, 1000)
    }
  }
}
</script>

<style scoped>
.classify-tabs >>> .el-tabs__item {
  text-align: left;
  width: 240px;
}
</style>
